package com.sxx.beautifulcity.toast;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.sxx.beautifulcity.R;
import com.sxx.beautifulcity.activity.SetSoftActivity;
import com.sxx.beautifulcity.application.ProjectApplication;

/**
 * Created by dllo on 15/11/5.
 */
public class commcommonToast extends Toast {

    private static Toast toast;
    /**
     * Construct an empty Toast object.  You must call {@link #setView} before you
     * can call {@link #show}.
     *
     * @param context The context to use.  Usually your {@link Application}
     *                or {@link Activity} object.
     */
    public commcommonToast(Context context) {
        super(context);

    }


    public static void failToast(){
        toast = Toast.makeText(ProjectApplication.getContext(), "请链接网络" , Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER , 0 , 0);
        LinearLayout layout = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(ProjectApplication.getContext());
        imageView.setImageResource(R.mipmap.iconfont_wangluowent);
        layout.addView(imageView , 0);
        toast.show();
    }

    public static void successToast(){
        toast = Toast.makeText(ProjectApplication.getContext(), "网络正常" , Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER , 0 , 0);
        LinearLayout layout = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(ProjectApplication.getContext());
        imageView.setImageResource(R.mipmap.iconfont_quanwanggaikuangzhengchang);
        layout.addView(imageView , 0);
        toast.show();
    }
    public static void submitToast(){
        toast = Toast.makeText(ProjectApplication.getContext(), "提交成功" , Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER , 0 , 0);
        LinearLayout layout = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(ProjectApplication.getContext());
        imageView.setImageResource(R.mipmap.iconfont_chenggong);
        layout.addView(imageView , 0);
        toast.show();
    }
    public static void loginSuccessToast(){
        toast = Toast.makeText(ProjectApplication.getContext(), "登陆成功" , Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER , 0 , 0);
        LinearLayout layout = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(ProjectApplication.getContext());
        imageView.setImageResource(R.mipmap.success);
        layout.addView(imageView , 0);
        toast.show();
    }

    public static void checkSoftVersion(){
        toast = Toast.makeText(ProjectApplication.getContext(), "亲,已是最新版本了哦" , Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER , 0 , 0);
        LinearLayout layout = (LinearLayout) toast.getView();
        ImageView imageView = new ImageView(ProjectApplication.getContext());
        imageView.setImageResource(R.mipmap.news_soft);
        layout.addView(imageView , 0);
        toast.show();
    }

}
